<?php slot('js_insideLoadFunction')?>
ADMIN_FILTER.key_search = '<?php echo __('filter_key_search',null,'table_list')?>';
ADMIN_FILTER.action = {
	error:{
		rowSelectedEmpty: '<?php echo __('error_row_selected', null, 'table_list')?>'
	},
	confirm:{
		deleteConfirm: '<?php echo __('row_delete_confirm', null, 'table_list')?>'
	}
}
ADMIN_FILTER.initFilter();
$('#filter_resource_id').val('<?php echo $data['filter']['filter_resource_id']?>').attr('selected', true);
$('#filter_gender_id').val('<?php echo $data['filter']['filter_gender_id']?>').attr('selected', true);
$('#filter_working_status').val('<?php echo $data['filter']['filter_working_status']?>').attr('selected', true);
$('#filter_search_method_id').val('<?php echo $data['filter']['filter_search_method_id']?>').attr('selected', true);


CANDIDATE.loading = '<center><img style="margin-top:30px;" src="/css/admin/img/global/ajax-loader.gif"/> &nbsp;<?php echo __('loading_text', null, 'candidate_candidates')?></center>';
CANDIDATE.actionName = '<?php echo ADMIN_DEFINED::SEARCH_CANDIDATE?>';
CANDIDATE.actionNameJob = '<?php echo ADMIN_DEFINED::SEARCH_JOB?>';
CANDIDATE.actionNameDelete = '<?php echo ADMIN_DEFINED::APPLY_DELETE?>';
CANDIDATE.actionNameEdit = '<?php echo ADMIN_DEFINED::APPLY_UPDATE?>';
CANDIDATE.actionNameInterview = '<?php echo ADMIN_DEFINED::AJAX_LOAD_INTERVIEW ?>';
CANDIDATE.init();


$('select#filter_level_id').val('<?php echo $data['filter']['filter_level_id']?>');
$('select#filter_major_id').val('<?php echo $data['filter']['filter_major_id']?>');
$('select#filter_foreign_language_id').val('<?php echo $data['filter']['filter_foreign_language_id']?>');
$('select#filter_information_technology_id').val('<?php echo $data['filter']['filter_information_technology_id']?>');

<?php end_slot()?>

<?php slot('header_css')?>
<style type="text/css">
<!--

div.box-content-main table.table-list td.area {
	width: 180px;
}

div.box-content-main table.table-list td.salary {
	width: 120px;
}

div.box-content-main table.table-list td.major{
	width: 180px;
}

label.filter {
	display: inline-block;
	width: 150px;
	margin-left: 30px;
}
.dt-tbl-ct-border {
	border-collapse: collapse;
	border-color: #ccc;
	width: 950px;
	border: 1px solid #ccc;
	background: #fff;
}
select.combo-box {
	width: 150px;
}

select.combo-box-search-method {
	width: 250px;
}

#page-content-right #inner .box-filter input.date-picker,#page-content-right #inner .box-filter input
	{
	margin-top: 3px;
	margin-bottom: 2px;
	width: 138px;
}

#page-content-right #inner .box-filter {
	padding: 20px 10px;
}

.td-border-top {
	border-top: 1px solid #dedede;
}

.td-border-bottom {
	border-bottom: 1px solid #dedede;
}
.job-search {
	line-height: 2.5em;
	margin-top: 20px;
}

.dt-label {
	display: inline-block;
	width: 160px;
}

.dt-lb-content {
	padding: 1px;
	border-bottom: 1px dotted #666;
	display: inline-block;
	width: 200px;
}
.dt-lb-content + .dt-label{
	margin-left:115px;
}
div.dt-lb-content {
	padding: 15px;
	border: 1px dotted #666;
	line-height: normal;
	display: block;
	width: 900px;
}

div.dt-control {
	text-align: right;
	padding: 10px 0px;
}

div.dt-control a {
	color: #00f;
}
#page-content-right #inner .box-filter input.chkMajor,
#page-content-right #inner .box-filter input.chkLevel{
	margin-top: 3px;
	margin-bottom: 2px;
	width: auto;
	margin-left: 20px;
}
label.chkNAV{
	display: inline-block;
	vertical-align: top;
	padding-top: 2px;
	padding-left: 5px;
}
img.pr-face{
	width: 300px;
	display: inline-block;
	border: 1px solid #ccc;
	float: left;
	margin-right: 30px;
	min-height:265px;
}
#page-content-right #inner .box-content .box-content-main table.table-list tr.exported-1{
	background: #F2F5A9;
}
#page-content-right #inner .box-content .box-content-main table.table-list tr.exported-1 + tr.exported-1{
	border-top: 1px solid #f00;
}
#page-content-right #inner .box-content .box-content-main table.table-list tr.exported-1:hover{
	background: #cfc;
}
-->
</style>
<?php end_slot()?>
<script type="text/javascript">
function filterSubmit(){
	$('input.money').each(function(){
		var $ob = $(this);
		$ob.val(MONEY.reverse($ob.val()));
	});
	return true;
}
</script>
<div class="box-navigation">
	<?php echo $data['navigation']?>
</div>
<div class="clr"></div>
<div class="box-filter" style="text-align: left">
	<form action="?" method="get" name="filter_form" id="filter_form" onsubmit="return filterSubmit();">
		<div class="tabs">
			<ul>
				<li><a href="#tabs-1"><?php echo __('filter_basic',null,'candidate_candidates')?></a></li>
				<li><a href="#tabs-2"><?php echo __('filter_advance',null,'table_list')?></a></li>
			</ul>
			<div id="tabs-1">
				<label	class="filter"><?php echo __('gender', null, 'candidate_candidates')?></label>
				<select name="filter[filter_gender_id]" id="filter_gender_id"	class="combo-box">
					<option value="-2"><?php echo __('option_all', null, 'table_list')?></option>
					<?php 
					$genders = AdminArrayData::getGender();
					foreach($genders as $k => $val):?>
					<option value="<?php echo $k?>"><?php echo __('gender_'.str_replace('-', '_', $k), null, 'array_data')?></option>
					<?php endforeach;?>
				</select> 
				<label class="filter"><?php echo __('label_working_status', null, 'candidate_candidates')?></label>
				<select name="filter[filter_working_status]" id="filter_working_status"	class="combo-box">
					<option value="-2"><?php echo __('option_all', null, 'table_list')?></option>
					<?php 
					$workings = AdminArrayData::getWorkingStatus();
					foreach($workings as $k => $val):?>
					<option value="<?php echo $k?>"><?php echo __('working_status_'.str_replace('-', '_', $k), null, 'array_data')?></option>
					<?php endforeach;?>
				</select> 
					<br />
				<label class="filter"><?php echo __('option_date_from', null, 'candidate_candidates')?></label>
				<span><input type="hidden" class="select-year filter" data-option-all="-------" data-from= "<?php echo sfConfig::get('app_ageRange_min')?>" data-to="<?php echo sfConfig::get('app_ageRange_max')?>"	name="filter[filter_birthday_from]" id="filter_birthday_from"	value="<?php echo $data['filter']['filter_birthday_from']?>" /></span> 
				
				<label	class="filter"><?php echo __('option_date_to', null, 'candidate_candidates')?></label>
				<span><input type="hidden" class="select-year filter" data-option-all="-------" data-from= "<?php echo sfConfig::get('app_ageRange_min')?>" data-to="<?php echo sfConfig::get('app_ageRange_max')?>"	name="filter[filter_birthday_to]" id="filter_birthday_to"	value="<?php echo $data['filter']['filter_birthday_to']?>" /></span> 
				
				<br/>
				<label class="filter"><?php echo __('label_resource_id', null, 'candidate_candidates')?></label>
				<select name="filter[filter_resource_id]" id="filter_resource_id"	class="combo-box">
					<option value="-1"><?php echo __('option_all', null, 'table_list')?></option>
					<?php foreach($data['filter_resource_id'] as $k => $val):?>
					<option value="<?php echo $k ?>"><?php echo $val['name']?></option>
					<?php endforeach;?>
				</select> 
				<label  class="filter"><?php echo __('filter_search_key', null, 'candidate_candidates')?></label>
				<input style="width: 270px" type="text" maxlength="255"	name="filter[filter_key]" id="filter_key" value="<?php echo empty($data['filter']['filter_key'])?__('filter_key_search',null,'table_list'):$data['filter']['filter_key']?>" />
				<br />
				
			</div>
			<div id="tabs-2">
				
				<label	class="filter"><?php echo __('filter_level_id', null, 'candidate_candidates')?></label>
				<select name="filter[filter_level_id]" id="filter_level_id"	class="combo-box">
					<option value="-1"><?php echo __('option_all', null, 'table_list')?></option>
					<?php foreach($data['filter_level_id'] as $lv):?>
					<option value="<?php echo $lv['id'] ?>"><?php echo $lv['name']?></option>
					<?php endforeach;?>
				</select> 
				<label	class="filter"><?php echo __('filter_major_id', null, 'candidate_candidates')?></label>
				<select name="filter[filter_major_id]" id="filter_major_id"	class="combo-box">
					<option value="-1"><?php echo __('option_all', null, 'table_list')?></option>
					<?php foreach($data['filter_major_id'] as $lv):
						if(count($lv['MasterMajors'])):  ?>
					<optgroup label="<?php echo $lv['name']?>">
					<?php 
						foreach($lv['MasterMajors'] as $mj):?>
							<option value="<?php echo $mj['id'] ?>"> . . <?php echo $mj['name']?></option>
					<?php 	endforeach; ?>
					</optgroup>
					<?php 
						endif;
					 endforeach;?>
				</select> 
				<br/>
				
				<label	class="filter"><?php echo __('filter_foreign_language_id', null, 'candidate_candidates')?></label>
				<select name="filter[filter_foreign_language_id]" id="filter_foreign_language_id"	class="combo-box">
					<option value="-1"><?php echo __('option_all', null, 'table_list')?></option>
					<?php foreach($data['filter_foreign_language_id'] as $lv):?>
					<option value="<?php echo $lv['id'] ?>"><?php echo $lv['language_name']?></option>
					<?php endforeach;?>
				</select> 
				<label	class="filter"><?php echo __('filter_information_technology_id', null, 'candidate_candidates')?></label>
				<select name="filter[filter_information_technology_id]" id="filter_information_technology_id"	class="combo-box">
					<option value="-1"><?php echo __('option_all', null, 'table_list')?></option>
					<?php foreach($data['filter_information_technology_id'] as $lv):?>
					<option value="<?php echo $lv['id'] ?>"><?php echo $lv['name']?></option>
					<?php endforeach;?>
				</select> 
				<br/>
				
				<label class="filter"><?php echo __('option_salary_from', null, 'candidate_candidates')?></label>
				<input type="text" class="filter number money" name="filter[filter_salary_from]" id="filter_salary_from"	value="<?php echo intval( $data['filter']['filter_salary_from'] ) ?>" /> 
				
				<label	class="filter"><?php echo __('option_salary_to', null, 'candidate_candidates')?></label>
				<input type="text" class="filter number money" name="filter[filter_salary_to]" id="filter_salary_to"	value="<?php echo intval($data['filter']['filter_salary_to'])?>" /> 
				<br/>
				
				<label  class="filter"><?php echo __('filter_created_from', null, 'candidate_candidates')?></label>
				<input class="date-picker" type="text" maxlength="8"	name="filter[filter_created_from]" id="filter_created_from" value="<?php echo $data['filter']['filter_created_from']?>" />
				<label  class="filter" style="margin-left: 10px"><?php echo __('filter_created_to', null, 'candidate_candidates')?></label>
				<input class="date-picker" type="text" maxlength="8"	name="filter[filter_created_to]" id="filter_created_to" value="<?php echo $data['filter']['filter_created_to']?>" />
				<br/>	
				<label  class="filter"><?php echo __('filter_updated_from', null, 'candidate_candidates')?></label>
				<input class="date-picker" type="text" maxlength="8"	name="filter[filter_updated_from]" id="filter_updated_from" value="<?php echo $data['filter']['filter_updated_from']?>" />
				
				<label  class="filter"  style="margin-left: 10px"><?php echo __('filter_updated_to', null, 'candidate_candidates')?></label>
				<input class="date-picker" type="text" maxlength="8"	name="filter[filter_updated_to]" id="filter_updated_to" value="<?php echo $data['filter']['filter_updated_to']?>" />
				<br />
				<!-- 
				<label	class="filter"><?php echo __('search_method', null, 'candidate_candidates')?></label>
				<select name="filter[filter_search_method_id]" id="filter_search_method_id"	 class="combo-box">
					 
					<?php 
					$searchMethod = AdminArrayData::searchMethod();
					foreach($searchMethod as $k => $val):?>
					<option value="<?php echo $k?>"><?php echo __('search_'.str_replace('-', '_', $k), null, 'array_data')?></option>
					<?php endforeach;?>
				</select>
				 
				<br />	
				<br/>
			 <label class="filter clickShow" style="cursor: pointer"><?php echo __('filter_level_id', null, 'candidate_candidates')?></label>
				<div style="display:inline-block ; width:750px; border:1px dotted #666;padding:0px 10px 10px 10px; margin-top:5px;margin-left: 30px; display: none">
				<?php 
					$count_for_level = 0;
					$loop = 4;
					$total = count($data['filter_level_id']);
					$oneLoop = ceil($total / $loop);
					for($i = 0; $i < $loop; $i++):?>
					<div style="float: left; width: 180px;margin-top:20px;">
					<?php 
						for($j = $i*$oneLoop; $j < $total && $j < ($i + 1) * $oneLoop; $j++):
						$per = $data['filter_level_id'][$j];
						?>
						<input class="chkLevel" type="checkbox" id="lv_<?php echo $per['id']?>" value="<?php echo $per['id']?>" name="filter[filter_level_ids][]"/><label for="lv_<?php echo $per['id']?>" class="chkNAV"><?php echo $per['name']?></label><br/>
						<?php 
						endfor;?>
						</div>
						<?php
						
					endfor;?>
					<div class="clr"></div>
				</div><div class="clr"></div>
				<br/>
				<label class="filter clickShow" style="cursor: pointer"><?php echo __('filter_major_id', null, 'candidate_candidates')?></label>
				<div style="display:inline-block ; width:750px; border:1px dotted #666;padding:0px 10px 10px 10px; margin-top:5px; margin-left: 30px; display: none">
				<?php 
					$count_for_major = 0;
					foreach ($data['filter_major_id'] as $pro):
						if(count($pro['MasterMajors'])):?>
					<div style="float: left; width: 260px;margin-top:20px;">
						<span><?php echo $pro['name']?></span><br/>
						<?php foreach($pro['MasterMajors'] as $per):?>
							<input class="chkMajor" type="checkbox" id="mj_<?php echo $per['id']?>" value="<?php echo $per['id']?>" name="filter[filter_major_id][]"/><label for="mj_<?php echo $per['id']?>" class="chkNAV"><?php echo $per['name']?></label><br/>
						<?php endforeach;?>
						
					</div>
					<?php	endif; 
					 echo (++$count_for_major % 3 == 0) ? '<div class="clr"></div>' : '' ?>
				<?php 	endforeach;?>
				</div><div class="clr"></div>
				<br/> 
				-->
			</div>
		</div>
		<input type="submit" name="filter[filter_submit]" id="filter_submit" class="button"	value="<?php echo __('filter_submit',null,'table_list')?>" />
	</form>
</div>
<div class="clr"></div>
<div class="box-content">
	<form action="<?php echo $data['filter_action']?>" method="post"	name="form_main" id="form_main">
		<input type="hidden" value="-1" name="action_token" id="action_token" />
		<input type="hidden" value="none" name="action_name" id="action_name" />
		<div class="control">
			<a href="#" class="a-control-get add" target="_blank" 	 data-action="<?php echo ADMIN_DEFINED::ADD_RECORD?>"	data-require="none"><?php echo __('control_add',null,'table_list')?></a>
			<a href="#" class="a-control delete" data-action="<?php echo ADMIN_DEFINED::DELETE_RECORD?>"	data-require="selected" data-confirm="confirm"><?php echo __('control_delete',null,'table_list')?></a>
		</div>
		<div class="pagination">
			<?php echo __('total', null, 'table_list'). ': '.$data['pagination']['total']?>
		</div>
		<div class="clr"></div>
		<div class="box-content-main">
			<table class="table-list" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td class="head checkbox-select"><input type="checkbox"	name="select_checkall" id="select_checkall"		title="<?php echo __('to_checkall',null,'table_list')?>" class="chk-select" /></td>
					<td class="head title"><?php echo __('head_name',null,'candidate_candidates')?></td>
					<td class="head major"><?php echo __('head_major',null,'candidate_candidates')?></td>
					
					<td class="head salary"><?php echo __('head_salary',null,'candidate_candidates')?></td>
					<td class="head year"><?php echo __('head_year',null,'candidate_candidates')?></td>
					<td class="head updated"><?php echo __('updated_at',null,'table_list')?></td>
					<td class="head created"><?php echo __('register_date',null,'candidate_candidates')?></td>
					<td class="head action" style="width:130px;"><?php echo __('action',null,'table_list')?></td>
					
				</tr>
				
			<?php
			$count_for = 0;
			foreach ( $data ['list'] ['candidates'] as $val ) :
			$isInExport = CandidateToExportsTable::inAny($val['id']);
				?>
				<tr	class="class<?php echo ++$count_for%2?> enable-<?php echo intval($val['is_enabled'])?> exported-<?php echo $isInExport?>" >
					<td class="checkbox-select"><input type="checkbox"	name="select_list[]" class="select_list"	value="<?php echo $val['id']?>"		id="select_<?php echo $val['id']?>"	title="<?php echo __('to_check',null,'table_list')?>" /></td>
					<td class="name">
						<a href="#"	data-id="<?php echo $val['id']?>" class="get-detail">
							<?php echo $val['full_name']?>
						</a>
					</td>
					<td class="area">
						<?php
							$majors = MasterMajorsTable::getDataListByCandidateId($val ['id'] );
							$str = '';
							foreach ( $majors as $m ) :
								echo $str, $m ['name'];
								$str = ', ';
							endforeach;
						?>
					</td>
					
					
					<td class="salary" >
						<span class=" money-show"><?php echo intval($val['salary_require'])>0?('<span class="money-show">'.$data['list']['salaries'][$val['salary_id']]['from'].'</span> - <span class="money-show">'.$data['list']['salaries'][$val['salary_id']]['to'].'</span>'):'-'?></span>
					</td>
					<td class="year">
						<?php echo date('Y',strtotime($val['date_of_birth'])) ?>
					</td>
					
					<td class="updated">
						<?php echo DateHelper::dateFormat($val['updated_at']) ?>
					</td>
					<td class="created_at">
						<?php echo DateHelper::dateFormat($val['register_date']) ?>
					</td>
					<td class="action">
							<a href="#" class="a-control-get edit" target="_blank" data-action="<?php echo ADMIN_DEFINED::EDIT_RECORD?>&id=<?php echo $val['id']?>"data-require="none" title="<?php echo __('edit',null,'table_list')?>"><img src="/css/admin/img/global/edit.png" /></a>
							<!-- &nbsp; <a href="#" class="add-export" data-title="<?php echo __('add_export', null, 'candidate_candidates')?>" data-action="get" data-id="<?php echo $val['id']?>" data-url="<?php echo sfConfig::get('app_prefix').url_for2('candidate_add_export') ?>" title="<?php echo __('add_export',null,'candidate_candidates')?>"><img src="/css/admin/img/global/mail-add-icon.png"/></a> -->
							&nbsp; <a href="#" class="ajax-history" data-action="<?php echo ADMIN_DEFINED::AJAX_HISTORY?>" data-id="<?php echo $val['id']?>" data-url="<?php echo sfConfig::get('app_prefix').url_for2('candidate_history',array('sf_culture'=>$sf_user->getCulture()))?>" title="<?php echo __('candidate-history',null,'candidate_candidates')?>"><img src="/css/admin/img/global/history-icon.png"/></a>
							&nbsp; <a href="#" class="ajax-apply" data-action="<?php echo ADMIN_DEFINED::AJAX_APPLY?>" data-id="<?php echo $val['id']?>" data-url="<?php echo sfConfig::get('app_prefix').url_for2('candidate_apply',array('sf_culture'=>$sf_user->getCulture()))?>" title="Ứng tuyển"><img src="/css/admin/img/global/control-enable.png"/></a>
							&nbsp; <a target="_blank" href="<?php echo sfConfig::get('app_prefix').url_for2('candidate_printer',array('sf_culture'=>$sf_user->getCulture(),'id'=>$val['id'],'action_name'=>ADMIN_DEFINED::AJAX_PRINTER))?>" title="<?php echo __('print',null,'table_list')?>"><img src="/css/admin/img/global/print-icon.png"/></a>
							&nbsp; <a target="_blank" href="<?php echo sfConfig::get('app_prefix').url_for2('candidate_export_pdf',array('sf_culture'=>$sf_user->getCulture(),'id'=>$val['id'],'action_name'=>ADMIN_DEFINED::AJAX_PDF))?>" title="<?php echo __('export-pdf',null,'table_list')?>"><img src="/css/admin/img/global/pdf-icon.png"/></a>
					</td>
				</tr>
				<tr	class="trdetail dtr_<?php echo $val['id']?> class<?php echo $count_for%2?> enable-<?php echo intval($val['is_enabled'])?>" data-id="<?php echo $val['id']?>">
					<td>&nbsp;</td>
					<td colspan="7" class="td-border-top">
						<div class="candidate-detail-information"></div>
						<div class="candidate-interview"></div>
						<div class="job-search"></div>
						<div class="dt-control">
							<a href="#" class="ajax-load-interview" data-id="<?php echo $val['id']?>"><?php echo __('action_interview',null,'candidate_candidates')?></a>
							&nbsp; | &nbsp;
							<?php
								$jPass = CandidatesTable::getListCandidatePassById($val['id']);
								$jWaitLong = CandidatesTable::getListCandidateWaitLongById($val['id']);
								if(empty($jPass) && empty($jWaitLong)) {
							?>
							<a href="#" class="ajax-search-job" data-id="<?php echo $val['id']?>"><?php echo __('action_search_job',null,'candidate_candidates')?></a>
							
							&nbsp; | &nbsp;
							<?php
								}
							?>
							<a href="#" class="a-control-get edit" target="_blank" 	data-action="<?php echo ADMIN_DEFINED::EDIT_RECORD?>&id=<?php echo $val['id']?>"data-require="none"><?php echo __('action_edit',null,'table_list')?></a>
							&nbsp; | &nbsp;<a target="_blank" href="<?php echo sfConfig::get('app_prefix').url_for2('candidate_printer',array('sf_culture'=>$sf_user->getCulture(),'id'=>$val['id'],'action_name'=>ADMIN_DEFINED::AJAX_PRINTER))?>" ><?php echo __('print',null,'table_list')?></a>
						</div>
					</td>
				</tr>
			
				<?php endforeach;?>
				<?php if($count_for==0):?>
				<tr>
					<td colspan="8">
						<div class="note"><?php echo __('no_row_founded',null,'table_list')?></div>
					</td>
				</tr>
				<?php endif;?>
			</table>
		</div>
		<div class="clr"></div>
		<div class="control">
			<a href="#" target="_blank" class="a-control-get add" data-action="<?php echo ADMIN_DEFINED::ADD_RECORD?>"	data-require="none"><?php echo __('control_add',null,'table_list')?></a>
			<a href="#" class="a-control delete"	data-action="<?php echo ADMIN_DEFINED::DELETE_RECORD?>"		data-require="selected"><?php echo __('control_delete',null,'table_list')?></a>
			
		</div>
		<?php if(count($data['pagination_pager'])>1):?>
		<div class="pagination">
			<span><?php echo __('pagination_text',null,'table_list')?></span> <span
				class="pagination"> 
			<?php foreach ($data['pagination_pager'] as $p):?>
				<a
				href="<?php echo empty($p['url'])?'#':($data['app_prefix'].$p['url'])?>"
				class="<?php echo $p['page_class']?>"><?php echo $p['page_num']?></a>
			<?php endforeach;?>
			</span>
			<div class="clr"></div>
		</div>
		<?php endif;?>
		<div class="clr"></div>
	</form>
</div>